import { Module } from '@nestjs/common';
import { DatabaseModule } from './shared/database/database.module';
import { UserModule } from './modules/user/user.module';
import { ConfigModule } from '@nestjs/config';
import Configuration from './common/configuration';
import { APP_FILTER } from '@nestjs/core';
import { GlobalExceptionFilter } from './common/exception/GlobalExceptionFilter';
import { AuthModule } from './shared/auth/auth.module';
import { CategoryModule } from './modules/category/category.module';
import { ArticleModule } from './modules/article/article.module';
import { WinstonLoggerModule } from './shared/logger/logger.module';
import { UploadModule } from './shared/upload/upload.module';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      ignoreEnvFile: false,
      load: [Configuration],
    }),
    DatabaseModule,
    UserModule,
    AuthModule,
    CategoryModule,
    ArticleModule,
    WinstonLoggerModule,
    UploadModule,
  ],
  providers: [
    {
      provide: APP_FILTER,
      useClass: GlobalExceptionFilter,
    },
  ],
})
export class AppModule {}
